﻿using System.Windows;
using DataModule;
using DeviceDemo.Services;
using DeviceDemo.Services.Interfaces;
using DeviceDemo.Views;
using DeviceModule;
using Prism.Ioc;
using Prism.Modularity;

namespace DeviceDemo
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App
    {
        protected override Window CreateShell()
        {
            return Container.Resolve<MainWindow>();
        }

        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            containerRegistry.RegisterSingleton<IMessageService, MessageService>();
        }

        protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
        {
            //moduleCatalog.AddModule<ModuleNameModule>();
            moduleCatalog.AddModule<DeviceModule.DeviceModule>();
            moduleCatalog.AddModule<CommonModule.CommonModule>();
            moduleCatalog.AddModule<DataModule.DataModule>();
        }

        protected override void OnInitialized()
        {
            base.OnInitialized();

            // 默认导航到 MainRegion 的设备视图
            var regionManager = Container.Resolve<Prism.Regions.IRegionManager>();
            regionManager.RequestNavigate("MainRegion", "DeviceListView");
        }

    }
}
